<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1></h1>
    <script src="./index.js"></script>

    <script>
      // MyAxios({
      //   method: "GET",
      //   url: "http://ajax-base-api-t.itheima.net/api/getbooks",
      // }).then((res) => {
      //   console.log(res);
      // });
      const PromiseAll = [
        MyAxios({
          method: "GET",
          url: "http://ajax-base-api-t.itheima.net/api/getbooks",
        }),
        MyAxios({
          method: "GET",
          url: "http://ajax-base-api-t.itheima.net/api/getbos",
        }),

        MyAxios({
          method: "GET",
          url: "http://ajax-base-api-t.itheima.net/api/getbooks",
        }),
      ];
      // Promise.all(PromiseAll).then(
      //   (res) => {
      //     document.querySelector("h1").innerHTML = "获取图书成功";
      //   },
      //   (err) => {
      //     document.querySelector("h1").innerHTML = err;
      //   }
      // )
      Promise.all(PromiseAll)
        .then((res) => {
          document.querySelector("h1").innerHTML = "获取图书成功";
        })
        .catch((err) => {
          console.log(err);
          document.querySelector("h1").innerHTML = err;
        });
    </script>
  </body>
</html>
